package com.muyu.payment.config;

import com.alipay.api.AlipayConfig;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.context.annotation.Bean;

/**
 * @author <a href="mailto:3546903628@qq.com">w1102</a>
 * @version 1.0
 * @description:
 * @date 2025/9/17 12:15
 */
@CacheConfig
public class AliPayWebConfig {
    /**
     *支付宝接口网关地址
     * @return
     */
    public static final String ALIPAY_GATEWAY_URL = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
    /**
     * 支付宝异步通知回调地址
     * 本地开发环境使用8080端口，实际生产环境需替换为正式域名
     */
    public static final String ALIPAY_NOTIE_URL = "http://localhost:8080/product/alipay/notify";
    /**
     * 沙箱中的appid
     */
    public static final String APPID ="9021000153644968";
    /**
     *应用私钥
     */
    public static final String PRIVATE_KEY ="MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCMwapa40EZlSJHNzLt+d8c79p/T3cHkH5HGhy8C3Irf3Dbn2c3gQbvLtV8orFUcOFzPMKcbR6J17arKma2FX+X451Bs4zbTDHIbiclxYWfRldzAmIqQ7k3ov0hIQJm5Po+npWsvovkgheGIJ4EUVCk3QKuyyh3yHooz0TKJ2SCNRcftNG5I47Oz/wzyYcLyDfe0I9c1z9piemMRMKhqPeFRN7gO+tCMJw8Uw4k7ayAO5rmlHmR4sbPHpZyNdJBNHLcA0eu5u1zKl652J56KgMLI5wAqnddT53WY6VWnmupxv9cdagvYHCHWT4j4pu4OY37cVUXb0MCIqrIIzt6jjuNAgMBAAECggEAWWiHKnZiGrr1bCEu86UdyQa+VtIGPMLWw5ldmUD4A5NO/+KQMNx/qByqtSGu3IFbY9S7lZtmo45nVPB5D742LygA8wP3PDF5CeSWb1K5XwPSdpaT/l7IXwPkIFAUc4GNR4t6baEXwU21XZiIZxuzyxUsKBWaHgQ1PIj0HCjLmjzl1zC8kD8htKvS/1V0Ief9XuohEbg+geXpK6liu1mdx1zS1NAdEClM9kNAEjAmbG82qtFSStI58zHJtriGu40m+iKIYLtRqXfe48MqT/rBENHkFTSiwgsqQVJnvlucO1yB4jZ9A5Qvu4FlZto6KEl3ifq1fsSis76eJYlHgTwdgQKBgQDXmIYSWV8sYyPQSwfCwey6ms4wyhdBdshIAS14AS9UFb8sJM5707J6Ps3luByACjKl+M8qi+vL+V+9rllWjBUFoou0R8P8xIjFDoIyHYFzOOlFcGj/8T4LzE6pTWNSrfVBRdXL11AIL4IfjvX+w476zFEHSp8PAZ41T2egN76aoQKBgQCnIqI+ct0GqgtU80z1i1S7eaYW2ICjSNEfEIoFe5s9I0ni6PceV4Jy8h+rcFCYTWN9bJlsvLIbLdVZOetFJ3/GUtyUQx7RSjrzGsX+iTx27i8dpIB2eiIWGrTROv2sEz0J3W5nkdHMCRgriY5XHkB/AS/9Dz8FfZXOtPinJRlFbQKBgQCCbQwWx6hS8vr0hJ+CS80JqqM4Utm0ycYqAURfh9/471sCupWLxasAV0Q6R6I+N20iiR3S8GjKsecgmfwD5qTFDuuTOaMwJDlVdQyAgucQLIq6bmGnDGtrucKQm3eNyh1HypanRW9uNEd1Dgh1ghraUIZocdU9v83VFF9tRqvxYQKBgEngHSbNTrUrZGbgRBwkwgc79hYTDIkgHo9EmD1kLXIQrxAFOXXH6Hk2XJlCw90OF/PQlOBjZ7Zrw+n0l/GxS+E1rxo5sN2BmhzqsKmZr4hCL8FCfSXhRj/O/i2djZMJzekWXz6YTcuKGYzk+G25iXiZ5cRNgOXEZPtBMsdutoThAoGBAM1Y9AABT7jiACTeWcf0m0OBiTTPOlxyL7rDyJ0D0is3bMXskUgMUMKjROAkBq92c3Hroy/3TNF0Hf43vtBq/vmnnfBUVl54kdDdxicghBqH61J6f2Cch7IH4iMVqqgff0bSfPCpK4bV8hRsEgKKTLGZoBbt+OcAbUhft0DUmTN3";

    /**
     * 支付宝公钥
     *
     */
    public static final String ALIPAY_PUBLIC_KEY ="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjMGqWuNBGZUiRzcy7fnfHO/af093B5B+RxocvAtyK39w259nN4EG7y7VfKKxVHDhczzCnG0eide2qypmthV/l+OdQbOM20wxyG4nJcWFn0ZXcwJiKkO5N6L9ISECZuT6Pp6VrL6L5IIXhiCeBFFQpN0Crssod8h6KM9EyidkgjUXH7TRuSOOzs/8M8mHC8g33tCPXNc/aYnpjETCoaj3hUTe4DvrQjCcPFMOJO2sgDua5pR5keLGzx6WcjXSQTRy3ANHrubtcypeudieeioDCyOcAKp3XU+d1mOlVp5rqcb/XHWoL2Bwh1k+I+KbuDmN+3FVF29DAiKqyCM7eo47jQIDAQAB";
    public static final String CHARSET = "UTF-8";
    public static final String SIGN_TYPE = "RSA2";
    /**
     * 自己的回调地址
     */
    public static final String ALIPAY_RETURN_URL = "http://localhost:8060/";

    @Bean
    public AlipayConfig alipayWebRouter() {
        AlipayConfig alipayConfig = new AlipayConfig();
        alipayConfig.setServerUrl(ALIPAY_GATEWAY_URL);
        alipayConfig.setAppId(APPID);
        alipayConfig.setPrivateKey(PRIVATE_KEY);
        alipayConfig.setFormat("json");
        alipayConfig.setAlipayPublicKey(ALIPAY_PUBLIC_KEY);
        alipayConfig.setCharset(CHARSET);
        alipayConfig.setSignType(SIGN_TYPE);
        return alipayConfig;
    }
}
